﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <SolidColorBrush x:Key="BrushGroupBoxHeaderBackground" Color="#FFFFFFFF"/>
    
    <Style TargetType="{x:Type GroupBox}">
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="FontFamily" Value="Tahoma"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="Padding" Value="10" />
        <Setter Property="Width" Value="200" />
        <Setter Property="Height" Value="200" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GroupBox}">
                    <Grid SnapsToDevicePixels="true" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="16"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Border Grid.Row="0" Grid.RowSpan="2" BorderBrush="{DynamicResource BrushGroupBoxBorder}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="4" OpacityMask="{x:Null}" Background="Transparent" Margin="0,8,0,0" VerticalAlignment="Stretch"/>
                        <!--Begin Header-->
                        <Border x:Name="Border" Grid.Row="0" Margin="6,0,0,0" CornerRadius="3" Background="{DynamicResource BrushGroupBoxHeaderBackground}" Width="{Binding ElementName=Header, Path=ActualWidth}" HorizontalAlignment="Left">
                            <Label x:Name="Header" Content="{TemplateBinding Header}" HorizontalAlignment="Left" Padding="3,1,3,1" Width="Auto"/>    
                        </Border>
                        <!--End Header-->
                        <!--Begin Content-->
                        <ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.Row="1" VerticalAlignment="Top"/>
                        <!--End Content-->
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Header" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="Border"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>